<?php
namespace app\common\service;

use think\Cache;

 class RedisComm{

    const VALIDITY_TIME = 86400;

    public static function Set($k = '', $v = null, $time = 0, $dbNum = 10){
        if(!empty($k) && !empty($v)){
            if($time == 0){
                $time = self::VALIDITY_TIME;
            }
            return Cache::store('redis')->set($k, $v, $time);
        }
        return false;
    }

    public static function Get($k = ''){
        if(!empty($k)){
            return Cache::store('redis')->get($k);
        }
        return false;
    }

    public static function IsExist($k = ''){
        if(!empty($k)){
            return Cache::store('redis')->has($k);
        }
        return false;
    }

    public static function Del($k = ''){
        if(!empty($k)){
            return Cache::store('redis')->rm($k);
        }
        return false;
    }

    public static function Clear($k = ''){
        if(!empty($k)){
            return Cache::store('redis')->clear($k);
        }
        return false;
    }
}
